package com.myprojects.webresources.config;


import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;

@WebServlet
public class MyServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        System.out.println("MyServlet.doGet");

        String page = request.getParameter("page");
        HttpSession session = request.getSession();
        if(page == null ) {
            request.getRequestDispatcher("WEB-INF/login.html").forward(request, response);
            return;
        }
        if(page != null ){
            request.getRequestDispatcher("WEB-INF/"+page + ".html").forward(request, response);
            return;
        }
    }

//    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
//
//    }
}
